using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Calendar.UI //frmAlertBudgetOverConsumed
{
    public partial class frmAlertBudgetOverConsumed : Form
    {
        DataTable dtTasks;
        int i4dtTasks = 0;

        public frmAlertBudgetOverConsumed(DataTable dt)
        {
            InitializeComponent();
            this.dtTasks = dt;
        }

        public frmAlertBudgetOverConsumed()
        {
            InitializeComponent();
        }

        private void frmAlertBudgetOverConsumed_Load(object sender, EventArgs e)
        {
            grpTask.Text = "Showing 1 of " + dtTasks.Rows.Count + " Milestone(s)";
            ShowTaskDetail();
            this.WindowState = FormWindowState.Normal;
            GlobalInfo.AlertFbocShownOnce = true;
        }

        private void ShowTaskDetail()
        {
            txtPrj.Text = dtTasks.Rows[i4dtTasks]["projectname"].ToString();
            txtMilestone.Text = dtTasks.Rows[i4dtTasks]["name"].ToString();
            txtPM.Text = dtTasks.Rows[i4dtTasks]["PM"].ToString();
            //txtPriority.Text = dtTasks.Rows[i4dtTasks]["prioritytype"].ToString();
            //txtSummary.Text = dtTasks.Rows[i4dtTasks]["ShortSummary"].ToString();
            //txtDesc.Text = dtTasks.Rows[i4dtTasks]["Description"].ToString();
            txtStartDate.Text = Convert.ToDateTime(dtTasks.Rows[i4dtTasks]["startdate"].ToString()).ToString("dd-MMM-yyyy hh:mm");
            txtEndDate.Text = Convert.ToDateTime(dtTasks.Rows[i4dtTasks]["estimatedEndDate"].ToString()).ToString("dd-MMM-yyyy  hh:mm");
            txtEstCost.Text = dtTasks.Rows[i4dtTasks]["estimatedCost"].ToString();
            txtConsCost.Text = dtTasks.Rows[i4dtTasks]["consumedCost"].ToString();
            txtToday.Text = DateTime.Now.ToString("dd-MMM-yyyy");
        }

        private void btnNext_Click(object sender, EventArgs e)
        {
            if (i4dtTasks < dtTasks.Rows.Count - 1) { i4dtTasks++; } //btnPrevious.Enabled = true; 
            ShowTaskDetail();
            grpTask.Text = "Showing " + (i4dtTasks + 1) + " of " + dtTasks.Rows.Count + " Task(s)";
        }

        private void btnPrevious_Click(object sender, EventArgs e)
        {
            if (i4dtTasks > 0) { i4dtTasks--; }
            ShowTaskDetail();
            grpTask.Text = "Showing " + (i4dtTasks + 1) + " of " + dtTasks.Rows.Count + " Task(s)";
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            frmAlertController.faboc = null;
            this.Dispose();
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            frmAlertController.faboc = null;
            this.Dispose();
        }

        private void Label12_Click(object sender, EventArgs e)
        {

        }


    }
}